package com.inspect;

import java.util.concurrent.*;

public class task implements Callable<String>{
    private final String path;

    public String getPath() {
        return path;
    }

    public task(String path) {//传进单位为秒，修改为毫秒
        this.path = path;
    }
    @Override
    public String call() throws Exception {
        try {
            data data = new data();
            data.readFile(path, 0);
            cplex model = new cplex(data);
            model.runModel(0);
            long startTime = data.startTime;
            long endTime = model.endTime;
            double seconds = (endTime - startTime) / 1000.0;
            double cost = model.cost;
            System.out.println(cost);
            return path + ":" + " " +
                    "path: " + path + " " + seconds + " " + cost + "\n";
        } catch (Exception e) {
            return "Error: " + e.getMessage();
        }
    }
}



